package com.util;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 日期工具类
 */
public class UtilDate {

    public static String YYYY = "yyyy";

    public static String YYYY_MM_DD = "yyyy-MM-dd";

    public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

    public static String now(){
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS));
    }

    public static String plusDay(int day) {
        return LocalDate.now().plusDays(day).format(DateTimeFormatter.ofPattern(YYYY_MM_DD));
    }

    public static String nowDate() {
        return LocalDate.now().format(DateTimeFormatter.ofPattern(YYYY_MM_DD));
    }

    public static String timeSeq(String create_time) {
        return create_time.replaceAll("-","").replaceAll(" ","").replaceAll(":","");
    }

    public static String year() {
        return LocalDate.now().format(DateTimeFormatter.ofPattern(YYYY));
    }
}
